package com.googlecode.pwlodars.piteststat.filesystembridge;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

public class FileSystemConnector {

	public File findFile(String filePath){
		return new File(filePath);
	}

	public List<File> listFolders(String pathToFiles) {
		List<File> directories=new LinkedList<File>();
		File[] files = new File(pathToFiles).listFiles();
		
		copyDirectoriesToResult(directories, files);
		return directories;
	}

	private void copyDirectoriesToResult(List<File> directories, File[] files) {
		for (File file : files) {
			if(file.isDirectory()){
				directories.add(file);
			}
		}
	}
}
